.class public Llt/farmis/libraries/bitflags/compatibility/android/BitSet;
.super Ljava/lang/Object;
.source "BitSet.java"

# interfaces
.implements Ljava/io/Serializable;
.implements Ljava/lang/Cloneable;


# static fields
.field private static final serialVersionUID:J = 0x6efd887e3934ab21L


# instance fields
.field private bits:[J

.field private transient longCount:I


# direct methods
.method public constructor <init>()V
    .locals 1

    const/4 v0, 0x1

    .line 79
    new-array v0, v0, [J

    invoke-direct {p0, v0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;-><init>([J)V

    return-void
.end method

.method private constructor <init>([J)V
    .locals 0

    .line 96
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 97
    iput-object p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    .line 98
    array-length p1, p1

    iput p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    .line 99
    invoke-direct {p0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->shrinkSize()V

    return-void
.end method

.method private static arrayForBits(I)[J
    .locals 0

    add-int/lit8 p0, p0, 0x3f

    .line 103
    div-int/lit8 p0, p0, 0x40

    new-array p0, p0, [J

    return-object p0
.end method

.method private checkIndex(I)V
    .locals 3

    if-ltz p1, :cond_0

    return-void

    .line 233
    :cond_0
    new-instance v0, Ljava/lang/IndexOutOfBoundsException;

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "index < 0: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/IndexOutOfBoundsException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method private ensureCapacity(I)V
    .locals 3

    .line 142
    iget-object v0, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    array-length v1, v0

    if-gt p1, v1, :cond_0

    return-void

    .line 145
    :cond_0
    array-length v0, v0

    mul-int/lit8 v0, v0, 0x2

    invoke-static {p1, v0}, Ljava/lang/Math;->max(II)I

    move-result p1

    .line 146
    new-array p1, p1, [J

    .line 147
    iget-object v0, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    iget v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    const/4 v2, 0x0

    invoke-static {v0, v2, p1, v2, v1}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 148
    iput-object p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    return-void
.end method

.method private readObject(Ljava/io/ObjectInputStream;)V
    .locals 0
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;,
            Ljava/lang/ClassNotFoundException;
        }
    .end annotation

    .line 754
    invoke-virtual {p1}, Ljava/io/ObjectInputStream;->defaultReadObject()V

    .line 756
    iget-object p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    array-length p1, p1

    iput p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    .line 757
    invoke-direct {p0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->shrinkSize()V

    return-void
.end method

.method private shrinkSize()V
    .locals 6

    .line 68
    iget v0, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    add-int/lit8 v0, v0, -0x1

    :goto_0
    if-ltz v0, :cond_0

    .line 69
    iget-object v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v2, v1, v0

    const-wide/16 v4, 0x0

    cmp-long v1, v2, v4

    if-nez v1, :cond_0

    add-int/lit8 v0, v0, -0x1

    goto :goto_0

    :cond_0
    add-int/lit8 v0, v0, 0x1

    .line 72
    iput v0, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    return-void
.end method

.method public static valueOf(Ljava/nio/ByteBuffer;)Llt/farmis/libraries/bitflags/compatibility/android/BitSet;
    .locals 10

    .line 714
    invoke-virtual {p0}, Ljava/nio/ByteBuffer;->slice()Ljava/nio/ByteBuffer;

    move-result-object p0

    sget-object v0, Ljava/nio/ByteOrder;->LITTLE_ENDIAN:Ljava/nio/ByteOrder;

    invoke-virtual {p0, v0}, Ljava/nio/ByteBuffer;->order(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;

    move-result-object p0

    .line 715
    invoke-virtual {p0}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v0

    const/16 v1, 0x8

    mul-int/lit8 v0, v0, 0x8

    invoke-static {v0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->arrayForBits(I)[J

    move-result-object v0

    const/4 v2, 0x0

    const/4 v3, 0x0

    .line 717
    :goto_0
    invoke-virtual {p0}, Ljava/nio/ByteBuffer;->remaining()I

    move-result v4

    if-lt v4, v1, :cond_0

    add-int/lit8 v4, v3, 0x1

    .line 718
    invoke-virtual {p0}, Ljava/nio/ByteBuffer;->getLong()J

    move-result-wide v5

    aput-wide v5, v0, v3

    move v3, v4

    goto :goto_0

    .line 720
    :cond_0
    :goto_1
    invoke-virtual {p0}, Ljava/nio/ByteBuffer;->hasRemaining()Z

    move-result v1

    if-eqz v1, :cond_1

    .line 721
    aget-wide v4, v0, v3

    invoke-virtual {p0}, Ljava/nio/ByteBuffer;->get()B

    move-result v1

    int-to-long v6, v1

    const-wide/16 v8, 0xff

    and-long/2addr v6, v8

    mul-int/lit8 v1, v2, 0x8

    shl-long/2addr v6, v1

    or-long/2addr v4, v6

    aput-wide v4, v0, v3

    add-int/lit8 v2, v2, 0x1

    goto :goto_1

    .line 723
    :cond_1
    invoke-static {v0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->valueOf([J)Llt/farmis/libraries/bitflags/compatibility/android/BitSet;

    move-result-object p0

    return-object p0
.end method

.method public static valueOf([B)Llt/farmis/libraries/bitflags/compatibility/android/BitSet;
    .locals 0

    .line 705
    invoke-static {p0}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;

    move-result-object p0

    invoke-static {p0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->valueOf(Ljava/nio/ByteBuffer;)Llt/farmis/libraries/bitflags/compatibility/android/BitSet;

    move-result-object p0

    return-object p0
.end method

.method public static valueOf([J)Llt/farmis/libraries/bitflags/compatibility/android/BitSet;
    .locals 1

    .line 681
    new-instance v0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;

    invoke-virtual {p0}, [J->clone()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, [J

    invoke-direct {v0, p0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;-><init>([J)V

    return-object v0
.end method


# virtual methods
.method public clone()Ljava/lang/Object;
    .locals 2

    .line 109
    :try_start_0
    invoke-super {p0}, Ljava/lang/Object;->clone()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;

    .line 110
    iget-object v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    invoke-virtual {v1}, [J->clone()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, [J

    iput-object v1, v0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    .line 111
    invoke-direct {v0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->shrinkSize()V
    :try_end_0
    .catch Ljava/lang/CloneNotSupportedException; {:try_start_0 .. :try_end_0} :catch_0

    return-object v0

    :catch_0
    move-exception v0

    .line 114
    new-instance v1, Ljava/lang/AssertionError;

    invoke-direct {v1, v0}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V

    throw v1
.end method

.method public equals(Ljava/lang/Object;)Z
    .locals 8

    const/4 v0, 0x1

    if-ne p0, p1, :cond_0

    return v0

    .line 123
    :cond_0
    instance-of v1, p1, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;

    const/4 v2, 0x0

    if-nez v1, :cond_1

    return v2

    .line 126
    :cond_1
    check-cast p1, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;

    .line 127
    iget v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    iget v3, p1, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    if-eq v1, v3, :cond_2

    return v2

    :cond_2
    const/4 v1, 0x0

    .line 130
    :goto_0
    iget v3, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    if-ge v1, v3, :cond_4

    .line 131
    iget-object v3, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v4, v3, v1

    iget-object v3, p1, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v6, v3, v1

    cmp-long v3, v4, v6

    if-eqz v3, :cond_3

    return v2

    :cond_3
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_4
    return v0
.end method

.method public get(I)Z
    .locals 5

    if-gez p1, :cond_0

    .line 170
    invoke-direct {p0, p1}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->checkIndex(I)V

    .line 172
    :cond_0
    div-int/lit8 v0, p1, 0x40

    .line 173
    iget v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    const/4 v2, 0x0

    if-lt v0, v1, :cond_1

    return v2

    .line 176
    :cond_1
    iget-object v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v0, v1, v0

    const-wide/16 v3, 0x1

    shl-long/2addr v3, p1

    and-long/2addr v0, v3

    const-wide/16 v3, 0x0

    cmp-long p1, v0, v3

    if-eqz p1, :cond_2

    const/4 v2, 0x1

    :cond_2
    return v2
.end method

.method public hashCode()I
    .locals 8

    const-wide/16 v0, 0x4d2

    const/4 v2, 0x0

    .line 157
    :goto_0
    iget v3, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    if-ge v2, v3, :cond_0

    .line 158
    iget-object v3, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v4, v3, v2

    add-int/lit8 v2, v2, 0x1

    int-to-long v6, v2

    mul-long v4, v4, v6

    xor-long/2addr v0, v4

    goto :goto_0

    :cond_0
    const/16 v2, 0x20

    shr-long v2, v0, v2

    xor-long/2addr v0, v2

    long-to-int v1, v0

    return v1
.end method

.method public length()I
    .locals 5

    .line 535
    iget v0, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    if-nez v0, :cond_0

    const/4 v0, 0x0

    return v0

    :cond_0
    add-int/lit8 v1, v0, -0x1

    mul-int/lit8 v1, v1, 0x40

    .line 538
    iget-object v2, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    add-int/lit8 v0, v0, -0x1

    aget-wide v3, v2, v0

    invoke-static {v3, v4}, Ljava/lang/Long;->numberOfLeadingZeros(J)I

    move-result v0

    rsub-int/lit8 v0, v0, 0x40

    add-int/2addr v1, v0

    return v1
.end method

.method public set(I)V
    .locals 6

    if-gez p1, :cond_0

    .line 186
    invoke-direct {p0, p1}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->checkIndex(I)V

    .line 188
    :cond_0
    div-int/lit8 v0, p1, 0x40

    .line 189
    iget-object v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    array-length v1, v1

    if-lt v0, v1, :cond_1

    add-int/lit8 v1, v0, 0x1

    .line 190
    invoke-direct {p0, v1}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->ensureCapacity(I)V

    .line 192
    :cond_1
    iget-object v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v2, v1, v0

    const-wide/16 v4, 0x1

    shl-long/2addr v4, p1

    or-long/2addr v2, v4

    aput-wide v2, v1, v0

    .line 193
    iget p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    add-int/lit8 v0, v0, 0x1

    invoke-static {p1, v0}, Ljava/lang/Math;->max(II)I

    move-result p1

    iput p1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    return-void
.end method

.method public toByteArray()[B
    .locals 5

    .line 743
    invoke-virtual {p0}, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->length()I

    move-result v0

    add-int/lit8 v0, v0, 0x7

    .line 744
    div-int/lit8 v0, v0, 0x8

    new-array v0, v0, [B

    const/4 v1, 0x0

    .line 745
    :goto_0
    array-length v2, v0

    if-ge v1, v2, :cond_0

    mul-int/lit8 v2, v1, 0x8

    .line 747
    div-int/lit8 v3, v2, 0x40

    .line 748
    iget-object v4, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v3, v4, v3

    ushr-long v2, v3, v2

    long-to-int v3, v2

    int-to-byte v2, v3

    aput-byte v2, v0, v1

    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    :cond_0
    return-object v0
.end method

.method public toString()Ljava/lang/String;
    .locals 11

    .line 549
    new-instance v0, Ljava/lang/StringBuilder;

    iget v1, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    div-int/lit8 v1, v1, 0x2

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(I)V

    const/16 v1, 0x7b

    .line 550
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    const/4 v1, 0x0

    const/4 v2, 0x0

    const/4 v3, 0x0

    .line 552
    :goto_0
    iget v4, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->longCount:I

    if-ge v2, v4, :cond_4

    .line 553
    iget-object v4, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v5, v4, v2

    const-wide/16 v7, 0x0

    cmp-long v4, v5, v7

    if-eqz v4, :cond_3

    move v4, v3

    const/4 v3, 0x0

    :goto_1
    const/16 v5, 0x40

    if-ge v3, v5, :cond_2

    .line 555
    iget-object v5, p0, Llt/farmis/libraries/bitflags/compatibility/android/BitSet;->bits:[J

    aget-wide v9, v5, v2

    const-wide/16 v5, 0x1

    shl-long/2addr v5, v3

    and-long/2addr v5, v9

    cmp-long v9, v5, v7

    if-eqz v9, :cond_1

    if-eqz v4, :cond_0

    const-string v5, ", "

    .line 557
    invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_2

    :cond_0
    const/4 v4, 0x1

    :goto_2
    mul-int/lit8 v5, v2, 0x40

    add-int/2addr v5, v3

    .line 561
    invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_1

    :cond_2
    move v3, v4

    :cond_3
    add-int/lit8 v2, v2, 0x1

    goto :goto_0

    :cond_4
    const/16 v1, 0x7d

    .line 566
    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    .line 567
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method
